<!--
# coding=UTF-8
# Copyright (c) 2025 Bird Software Solutions Ltd
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#    Neil Mackenzie - initial API and implementation
#    Benjamin Arfa - improvements
#
-->
{% extends "base.html" %}
{% load static %}

{% block title %}FreeBIRD Application - Workflow{% endblock %}

{% block extra_css %}
<style>
    .workflow-container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 20px;
    }
    
    .task-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-bottom: 30px;
    }
    
    .task-card {
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 15px;
        background: #f8f9fa;
    }
    
    .task-card.active {
        background: #e3f2fd;
        border-color: #2196f3;
    }
    
    .task-card h3 {
        margin: 0 0 10px 0;
        font-size: 16px;
    }
    
    .task-operations {
        display: flex;
        gap: 10px;
        margin-top: 10px;
    }
    
    .operation-btn {
        flex: 1;
        padding: 5px 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        text-align: center;
        text-decoration: none;
        font-size: 12px;
        background: white;
        color: #333;
    }
    
    .operation-btn:hover {
        background: #f0f0f0;
    }
    
    .operation-btn.completed {
        background: #4caf50;
        color: white;
        border-color: #4caf50;
    }
    
    .operation-btn.running {
        background: #2196f3;
        color: white;
        border-color: #2196f3;
    }
    
    .operation-btn.failed {
        background: #f44336;
        color: white;
        border-color: #f44336;
    }
    
    .operation-btn.paused {
        background: #ff9800;
        color: white;
        border-color: #ff9800;
    }
    
    .operation-btn.invalidated {
        background: #9e9e9e;
        color: white;
        border-color: #9e9e9e;
    }
    
    .progress-bar {
        height: 30px;
        background: #e0e0e0;
        border-radius: 15px;
        overflow: hidden;
        margin-bottom: 20px;
    }
    
    .progress-fill {
        height: 100%;
        background: #4caf50;
        transition: width 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: bold;
    }
    
    .workflow-breadcrumb {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 20px;
        padding: 10px;
        background: #f5f5f5;
        border-radius: 4px;
    }
    
    .breadcrumb-separator {
        color: #666;
    }
    
    .task-content {
        background: white;
        border-radius: 8px;
        padding: 20px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
</style>
{% endblock %}

{% block content %}
<div class="workflow-container">
    {% block workflow_breadcrumb %}
    <div class="workflow-breadcrumb">
        <a href="{% url 'pybirdai:workflow_dashboard' %}">Workflow Dashboard</a>
        {% block breadcrumb_items %}{% endblock %}
    </div>
    {% endblock %}
    
    {% block workflow_content %}{% endblock %}
</div>
{% endblock %}

{% block extra_js %}
<script>
    // Auto-refresh task status
    function refreshTaskStatus() {
        // Implementation for auto-refreshing task status
    }
    
    // Initialize on page load
    document.addEventListener('DOMContentLoaded', function() {
        // Set up periodic refresh if needed
        {% block workflow_js %}{% endblock %}
    });
</script>
{% endblock %}